/**
 * Copyright (c) 2024 Huawei Technologies Co., Ltd.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE-MIT file in the root directory of this source tree.
 */

import {Button, Text, View} from 'react-native';
import React, {useState} from 'react';
import RTNCalculator from '../rnohTurbo/NativeCalculator';

function App() {
  const [result, setResult] = useState(0);

  return (
    <View style={{backgroundColor: 'lightblue', flex: 1, padding: 20}}>
      <Text>
        Lorem, ipsum dolor sit amet consectetur adipisicing elit. Aut quo a
        accusamus obcaecati rem! Qui itaque, necessitatibus ex cupiditate,
        distinctio officiis laborum velit nemo officia voluptatibus sequi illum
        iure odit!
      </Text>

      <Text style={{marginLeft: 20, marginTop: 20}}>3+7={result ?? '??'}</Text>
      <Button
        title="js sync test"
        onPress={() => {
          const a = 1;
          a += 2;
        }}></Button>

      <Button
        title="js async test"
        onPress={async () => {
          const a = 1;
          a += 2;
        }}></Button>

      <Button
        title="Compute"
        onPress={() => {
          RTNCalculator?.add(3, 7);
        }}
      />
      <Button
        title="ComputeSync"
        onPress={() => {
          RTNCalculator?.addSync(3, 7);
        }}
      />
    </View>
  );
}

export default App;
